package cn.regexp.web.controller;

import cn.regexp.domain.ShopIngredient;
import cn.regexp.service.IIngredientService;
import cn.regexp.utils.JsonResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("ingredient")
public class IngredientController {

    @Autowired
    private IIngredientService ingredientService;
    @ApiOperation(value = "查询食材", notes = "查询食材")
    @GetMapping("/queryIngredient")
    public JsonResult<List<ShopIngredient>> queryIngredient() {
        QueryWrapper<ShopIngredient> wrapper = new QueryWrapper<>();
        wrapper.eq("state", ShopIngredient.Ingredient_UP);
        return  JsonResult.success(ingredientService.list(wrapper));
    }

}
